package entity

import "xmediaEmu/pkg/cws"

const (
	// CloseLive 视频增强处理.
	CloseLive = "close_Live"

	LiveStart   = "Live_start"
	LiveStarted = "Live_started"
	LiveQuit    = "Live_quit"
)

// LiveStartCall RoomStart对应的命令.
type LiveStartCall struct {
	Name             string `json:"name"`
	AudioPayloadType int    `json:"audioPayload"`
	VideoPayloadType int    `json:"videoPayload"`

	// TODO: 定义ip 和port直接传送.
	Zone string `json:"zone,omitempty"` // default: udp
	Addr string `json:"addr,omitempty"` // ip:port string
}

func (packet *LiveStartCall) From(data string) error { return from(packet, data) }
func (packet *LiveStartCall) To() (string, error)    { return to(packet) }

// RoomStart对应的响应.
type LiveStartRsp struct {
	RoomId string `json:"room"`
	Sdp    string `json:"sdp,omitempty"` // SdpOffer结构体.
}

func (packet *LiveStartRsp) From(data string) error { return from(packet, data) }
func (packet *LiveStartRsp) To() (string, error)    { return to(packet) }

//type ConnectionRequest struct {
//	Zone string `json:"zone,omitempty"` // default: udp
//	Addr string `json:"addr,omitempty"`
//	// IsHTTPS  bool   `json:"is_https,omitempty"`
//}

// CloseLivePacket close room.data只有roomId.
func CloseLivePacket(data string) cws.WSPacket { return cws.WSPacket{ID: CloseLive, Data: data} }
